
function pickTrump(action) {
    var cards = action.cards;

    var sortedCards = new Array(new Array(), new Array(), new Array(), new Array());

    for (index in cards) {
        var card = cards[index];
        sortedCards[card.suit.ordinal()][sortedCards[card.suit.ordinal()].length] = card
//        if (card.suit == "hearts") {
//            sortedCards[0][sortedCards[0].length] = card
//            println(card.value.ordinal())
//        }
    }

//    println(sortedCards)
    sortedCards.sort(sortSuitsReversed)
    println("barva trumfu: " + sortedCards[0][0].suit + ", pocet: " + sortedCards[0].length)

    var trumps = sortedCards[0].sort(sortCards)
    return trumps[0]

//    println(sortedCards[0]);
//    sortedCards[0].sort(sortCards);
//    println(sortedCards[0]);
//    println("pocet cervenych: " + sortedCards[0].length);
}

function sortCards(a, b) {
    return a.value.ordinal() - b.value.ordinal();
}

function sortSuitsReversed(a, b) {
    return -a.length + b.length
}


function dropTalon(action) {
    
}